package cn.edu.fzu.delivery.controller.sys;

import cn.edu.fzu.delivery.common.Result;
import cn.edu.fzu.delivery.domain.entity.Area;
import cn.edu.fzu.delivery.service.AreaService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author yifan
 * @date 2022/11/7
 */
@RestController
@RequestMapping("/api/sys/area")
@Api(tags = "地区管理")
public class AreaController {

    @Resource
    private AreaService areaService;

    @GetMapping("/list")
    @ApiOperation(value = "获取地区列表", httpMethod = "GET")
    @ApiImplicitParam(name = "cityId", value = "所属城市id")
    public Result list(Long cityId) {
        List<Area> areas = areaService.list(cityId);
        return new Result(areas);
    }
}
